package cn.wolfcode.wolf2w.service.impl;


import cn.wolfcode.wolf2w.domain.TravelUserIdFavors;
import cn.wolfcode.wolf2w.repository.TravelUserIdFavorsRepository;
import cn.wolfcode.wolf2w.service.ITravelUserIdFavorsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Optional;

@Service
public class TravelUserIdFavorsServiceImpl implements ITravelUserIdFavorsService {
    @Autowired
    private TravelUserIdFavorsRepository travelUserIdFavorsRepository;


    @Override
    public void insert(TravelUserIdFavors travelUserIdFavors) {
        travelUserIdFavorsRepository.save(travelUserIdFavors);
    }

    @Override
    public void delete(String id) {
        travelUserIdFavorsRepository.deleteById(id);
    }

    @Override
    public void update(TravelUserIdFavors travelUserIdFavors) {
        travelUserIdFavorsRepository.save(travelUserIdFavors);
    }

    @Override
    public TravelUserIdFavors findById(String id) {
        Optional<TravelUserIdFavors> travelUserIdFavors = travelUserIdFavorsRepository.findById(id);
        return travelUserIdFavors.orElse(null);
    }

    @Override
    public List<TravelUserIdFavors> findAll() {
        List<TravelUserIdFavors> all = travelUserIdFavorsRepository.findAll();
        return all;
    }


}
